<template lang="html">

<div class="head_bar">


  <div class="logo">
    <img src="~assets/images/logo.png" alt="">
  </div>
  <div class="head_link">
    <div class="nav_list">
      <router-link to="/dashboard" tag="div" class="nav_item"><a>主页</a><div class="nav_triangle"></div></router-link>
      <router-link to="/auditCenter" tag="div" class="nav_item"><a>审核中心</a><div class="nav_triangle"></div></router-link>
      <router-link to="/usercenter" tag="div" class="nav_item"><a>用户中心</a><div class="nav_triangle"></div></router-link>
      <router-link to="/ordercenter" tag="div" class="nav_item"><a>订单中心</a><div class="nav_triangle"></div></router-link>
      <router-link to="/tradingcenter" tag="div" class="nav_item"><a>交易中心</a><div class="nav_triangle"></div></router-link>
      <router-link to="/systemconfig" tag="div" class="nav_item"><a>系统配置</a><div class="nav_triangle"></div></router-link>
    </div>

  </div>
  <div class='denglu' @click="login_out">
    退出
  </div>
  <div class='username'>
    <span class="user_ph"></span>
    <span class="user_name">{{username}}</span>
  </div>
</div>


</template>

<script>
// import { mapState } from 'vuex'
import { axios } from 'api/config'
import { Message } from 'element-ui';

export default {
  data () {
    return {
      username: 'admin',
      change_dia_show: false,
      cur_app_id: 1,
      params_reset: 0
    }
  },
  components: {

  },

  methods: {
    login_out() {
        this.$confirm('此操作将退出打零工后台管理系统, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          axios.post('/user/logout.do'
          ).then(
              () => {
                  this.$router.push({ path: command })
                  window.sessionStorage.removeItem('__login__')
                  window.sessionStorage.removeItem('userNamess')
                  this.$message({
                    type: 'success',
                    message: '退出成功!'
                  });
              }
          ).catch(err => { console.log(err) })

        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消退出'
          });
        });
      }





  },

  mounted () {

  },
  created () {

  }
}
</script>

<style lang="scss">
.head_bar {
  .denglu {
    cursor: pointer;
  }
  .nav_triangle{
    width: 28px;
    height: 4px;
    // border-right: 10px solid transparent;
    // border-left: 10px solid transparent;
    // display: none;
  }
  .global_search .icon-search{
    color: #fff;
    font-size: 24px;
  }
  .logout{
    margin-top: 14px;
  }
  .icon-user{
    color: #fff;
    font-size: 20px;
  }
}
.change_app_dia {
  .el-dialog__body {
    padding: 0px 20px 0px;
  }
}
</style>
